export default (listeners = {}) => {
  return {
    rules: {
      userId: [
        { required: true, message: '用户ID不能为空', trigger: 'blur' },
      ],
      fileName: [
        { required: true, message: '文件名不能为空', trigger: 'blur' },
      ],
      fileType: [
        { required: true, message: '文件类型不能为空', trigger: 'change' },
      ],
      storagePath: [
        { required: true, message: 'URL地址不能为空', trigger: 'blur' },
      ],
      createdAt: [
        { required: true, message: '上传时间不能为空', trigger: 'blur' },
      ],
    },
    formItems: [
      {
        field: 'userId',
        type: 'input',
        label: '用户ID',
        config: {
          clearable: false,
          maxlength: 30,
        },
      },
      {
        field: 'fileName',
        type: 'input',
        label: '文件名',
        config: {
          clearable: false,
          maxlength: 100,
        },
      },
      {
        field: 'fileType',
        type: 'input',
        label: '文件类型',
        config: {
          clearable: false,
          placeholder: '请输入文件扩展名，如jpg, pdf, doc等',
          maxlength: 20
        },
      },
      {
        field: 'storagePath',
        type: 'upload',
        label: 'URL地址',
        config: {
          clearable: false,
          accept: 'image/jpeg,image/png,image/gif,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,.zip,.rar',
          maxSize: 10 // 最大10MB
        },
      },
      {
        field: 'isEncrypted',
        type: 'radio',
        options: [],
        label: '是否加密',
        isGroup: true,
        config: {
          clearable: false,
        },
        optionConfig: {
          border: true,
        },
      },
      {
        field: 'encryptionKey',
        type: 'input',
        label: '加密密钥',
        config: {
          clearable: false,
        },
      },
      {
        field: 'createdAt',
        type: 'datepicker',
        label: '上传时间',
        config: {
          clearable: false,
          valueFormat: 'YYYY-MM-DD',
        },
      },
    ],
    colLayout: {
      xl: 12,
      lg: 12,
      md: 12,
      sm: 12,
      xs: 24,
    },
    itemStyle: {
      padding: '0px 8px 0px 8px',
    },
    elFormConfig: {
      labelWidth: '80px',
    },
    hideItems: ref([]),
  }
} 